﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Collections;

namespace LoginServer
{
    public class DistributedProcessing
    {
        //public ManagerMachine GetMinTable(List<ManagerMachine> Machines)
        //{        
        //    ManagerMachine min=null;
        //    foreach (ManagerMachine tmp in Machines)
        //    {                
        //        if (min == null)
        //        {
        //            min = tmp;
        //            continue;
        //        }
        //        if (tmp.CountTable < min.CountTable)
        //            min = tmp;
                    
        //    }
        //    return min;
        //}

        internal ManagerMachine GetMinRoom(List<ManagerMachine> list_manager_machine)
        {
            ManagerMachine min = null;
            foreach (ManagerMachine tmp in list_manager_machine)
            {
                if (min == null)
                {
                    min = tmp;
                    continue;
                }
                if (tmp.CountRoom < min.CountRoom)
                    min = tmp;
            }
            return min;
        }

        internal ManagerMachine GetRoomOwn(List<ManagerMachine> list_manager_machine, int RoomID)
        {
            foreach (ManagerMachine tmp in list_manager_machine)
            {
                if (tmp.CheckRoomExist(RoomID))
                {
                    return tmp;
                }
            }
            return null;
        }
    }
}
